<template>
  <!--会签管理-单据申请-工程项目合同审批弹窗-->
    <j-modal
      :title="title"
      :width="width"
      :visible="visible"
      switchFullscreen
      @ok="handleOk"
      :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }"
      @cancel="handleCancel"
      okText="提交审核"
      cancelText="保存"
    >
      <wt-projectcontact-form :countersignTemplateId="countersignTemplateId" @error="handleCancel" ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></wt-projectcontact-form>
      <template #footer>
            <a-button key="back" @click="handleCancel">取消</a-button>
            <a-button key="save" @click="handleSave">保存</a-button>
            <a-button key="submit" type="primary" @click="handleOk">提交审核</a-button>
          </template>
    </j-modal>
  </template>

    <script>
  import WtProjectcontactForm from './WtProjectcontactForm'
  export default {
    name: 'WtShenpiModal',
    components: {
        WtProjectcontactForm,
    },
    props: {
      countersignTemplateId: {
        type: String,
        default: '',
      },
    },
    data() {
      return {
        title: '',
        width: 1000,
        visible: false,
        disableSubmit: false,
        pegeType:'',
      }
    },
    methods: {
      add(record,type) {
        this.visible = true
        this.$nextTick(() => {
          this.$refs.realForm.add(record,type)
        })
      },
      edit(record) {
        this.visible = true
        this.$nextTick(() => {
          this.$refs.realForm.edit(record)
        })
      },
      close() {
        this.$emit('close')
        this.visible = false
      },
      handleOk() {
        this.$refs.realForm.submitForm('1')
      },
      submitCallback() {
        this.$emit('ok')
        this.visible = false
      },
      handleCancel() {
        this.close();
      },
      handleSave(){
        this.$refs.realForm.submitForm('0')
      }
    },
  }
  </script>